// pages/order-detail/order-detail.js
var api = require('../../../config/api.js');
var util = require('../../../utils/util.js');
var app = getApp();
Page({

    /**
     * 页面的初始数据
     */
    data: {
      imgUrl:api.RootUrl,
      order: null,
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        var page = this;
        page.setData({
          store:wx.getStorageSync("store")
        });
        wx.showLoading({
            title: "正在加载",
        });
        util.request(api.OrderDetail, { orderId: options.id}).then(function(res){
          if (res.errno == 0) {
            page.setData({
              order: res.data.order,
            });
            wx.hideLoading();
          }
        });

    },

    copyText: function (e) {
        var page = this;
        var text = e.currentTarget.dataset.text;
        wx.setClipboardData({
            data: text,
            success: function () {
                wx.showToast({
                    title: "已复制"
                });
            }
        });
    }

});